package com.woniuxy.springbootpro.service.impl;

import com.woniuxy.springbootpro.entity.Role;
import com.woniuxy.springbootpro.mapper.RoleMapper;
import com.woniuxy.springbootpro.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class RoleServiceImpl implements RoleService {

    private RoleMapper roleMapper;

    @Autowired
    public void setRoleMapper(RoleMapper roleMapper) {
        this.roleMapper = roleMapper;
    }

    @Override
    public List<Role> findAll() {
        return roleMapper.findAll();
    }

    @Override
    public boolean add(Role role) {
        return roleMapper.insert(role) != 0;
    }

    @Override
    public boolean delete(Integer id) {
        return roleMapper.deleteByPrimaryKey(id) != 0;
    }

    @Override
    public boolean updata(Role role) {
        return roleMapper.updateByPrimaryKeySelective(role) != 0;
    }
}
